package com.chinatelecom.config;

import io.swagger.v3.oas.models.OpenAPI;
import org.springframework.boot.actuate.trace.http.HttpTraceRepository;
import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * web.xml
 */
@Configuration
public class WebConfig {


    @Bean
    public OpenAPI OpenAPI() {
        return new OpenAPI()
                .info(new io.swagger.v3.oas.models.info.Info()
                        .title("SpringDoc API Test")
                        .description("SpringDoc Simple Application Test")
                        .version("0.0.1"));
    }

    /**
     * spring-boot 2.2以上版本默认不启用HttpTraceRepository，需要使用者在工程中显示声明才可以正常使用
     */
    @Bean
    public HttpTraceRepository buildHttpTraceRepository() {
        return new InMemoryHttpTraceRepository();
    }

}
